<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Information extends Model
{
    public $timestamps = false;
    protected $connection = 'xz';
    protected $table = 'information';
    use HasFactory;

    public function getCreateTimeAttribute(string $value)
    {
        return Date("Y-m-d H:i:s",$value);
    }

    public function types()
    {
        return $this->hasOne('App\Models\InformationType','id','type')->select('id','name');
    }

    public function likes()
    {
        return $this->hasMany('App\Models\InformationLike','nid','id');
    }

    public function collects()
    {
        return $this->hasMany('App\Models\InformationCollection','nid','id');
    }


}
